<!DOCTYPE html>
<html>

<head>
    <include file="public@head" title="文件管理" keywords=""/>
</head>

<body class="layui-layout-admin">
<include file="public@header"/>
<include file="public@side"/>
<div class="layui-body">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a href="{:url('admin/index/index')}">主页</a>
        <a>内容管理</a>
        <a href="{:url('index')}"><cite>文件管理</cite></a>
    </div>
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-card-header">

                <div class="listsTable layui-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label">文件管理</label>
                        <div class="layui-input-block">
                            <button type="button" class="layui-btn" id="btn-asset">
                                <i class="layui-icon">&#xe67c;</i>选择文件
                            </button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-card-body">
                <table class="layui-hide table-center" id="lists" lay-filter="lists" lay-size="lg"></table>
            </div>
        </div>
    </div>
</div>
<include file="public@scripts"/>
<script>
    var table = layui.table;

    table.render({
        elem: '#lists',
        even: true,
        url: "{:url('getAssets')}",
        cols: [[
            {field: 'id', title: 'ID', align: 'center', width: 60}
            , {field: 'file_name', title: '文件名称'}
            , {field: 'path', title: '目录', width: 180}
            , {field: 'type', title: '文件类型', width: 180}
            , {field: 'size', title: '文件大小（Bit）', width: 150}
            , {field: 'file_path', title: '文件目录'}
        ]],
        page:true
    });

    let upload = layui.upload;

    upload.render({
        elem: '#btn-asset',
        url: "{:url('api/asset/fileUpload')}",
        accept: 'file',
        data: {path: 'asset'},
        done: function (res) {
            if (res.code == 0) {
                return layer.msg(res.message);
            }
        }
    });
</script>
</body>

</html>
